package com.yuanthink.gwt.client.workplace;

import com.extjs.gxt.ui.client.Style.HideMode;
import com.extjs.gxt.ui.client.data.BaseTreeModel;
/**
 * 
 * @author 06peng
 *
 */
public class Entry extends BaseTreeModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private boolean fill;
	private boolean closable = true;
	private HideMode hideMode = HideMode.DISPLAY;

	public Entry(String name, String actionId) {
		this.name = name;
		set("name", name);
		set("actionId", actionId);
	}

	public Entry(String name, String actionId, boolean fill) {
		this(name, actionId);
		this.fill = fill;
	}

	public Entry(String name, String actionId, boolean fill, boolean closable) {
		this(name, actionId, fill);
		this.closable = closable;
	}

	public Entry(String name, String actionId, boolean fill, boolean closable, HideMode hideMode) {
		this(name, actionId, fill, closable);
		this.setHideMode(hideMode);
	}

	protected Entry() {

	}

	public Object getWorkplace() {
		return (Object) get("actionId");
	}

	public String getId() {
		if (name.equals("% Columns")) {
			return "percentcolumns";
		}
		return name.replaceAll(" ", "").toLowerCase();
	}

	public HideMode getHideMode() {
		return hideMode;
	}

	public String getName() {
		return (String) get("name");
	}

	public boolean isClosable() {
		return closable;
	}

	public boolean isFill() {
		return fill;
	}

	public void setFill(boolean fill) {
		this.fill = fill;
	}

	public void setHideMode(HideMode hideMode) {
		this.hideMode = hideMode;
	}

	public String toString() {
		return getName();
	}

}
